//文件保存所有打包配置

//注意事项
/**
 * 1. 文件夹里面的share.html文件需要配置一下
 * 2. webpack中的index请求代理本地开发时需要配置一下，打包时可以需要切换
 */
if(process.env.NODE_ENV == "development"){
    let packType = 0;
}else{
    let packType = 1;
}
// console.log(process.env.NODE_ENV)
//本地开发
// const packType = 0;

//部署测试环境
// const packType = 1;

//部署正式环境
const packType = 2;


//所有请求页面配置
let loginConfig = ()=>{
    if(packType == 0){
        return { 
            "appId":"APP2018012300004",                             //本地环境配置,默认账号
            // "userId":"openId2200",                               //本地账号
            "userId":"oHp37w2pgB8dJDR0tt8HmBpqq4PE",                //林丹账号
            // "userId":"oHp37w5OS-WHAv_fA1eq9_aV6844",             //张斌测试账号
            // "userId":"qazwsx123456789",                          //店员测试openId
            "institutionNo":"IN20180625000053",             
            "packType": packType,
        }
    }else if(packType == 1){
        return {
            "appId":"APP2018062500018",                     //非本地环境配置
            "userId":'',
            "institutionNo":"IN20180625000053",
            "packType": packType,
        }
    }else if(packType == 2){
        return {
            "appId":"APP2018062500018",                     //非本地环境配置
            "userId":'',
            "institutionNo":"IN20180717000001",
            "packType": packType,
        }
    }
}

//请求端口号配置:
let requestPort = ()=>{
    if(packType == 0){
        return 'api/ecshop-server';     //本地服务配置
    }else if(packType == 1){
        return "/ecshop-server";        //测试环境配置
    }else if(packType == 2){
        return '/server';               //咖啡馆正式环境配置
    }
}

//vuex中保存的图片路径
let picUrl = ()=>{
    if(packType == 0){
        return "http://ecshoptest.ebj.ebjcloud.com/ecshop/img/";
    }else if(packType == 1){
        return "http://ecshoptest.ebj.ebjcloud.com/ecshop/img/";//公众号测试地址
    }else if(packType == 2){
        return "http://oneshop.1bpcafe.cn/ecshop/img/";//咖啡馆测试地址
    }
}

//baseinfo文件里面的配置
let baseinfo = ()=>{
    if(packType == 0){
        return {
            preUrl:"api/ecshop-server/",
            appid:"wx3ef4c5ac724a17a3",
        }
    }else if(packType == 1){
        return {
            preUrl:"http://ecshoptest.ebj.ebjcloud.com/ecshop-server/", //测试公众号环境
            appid:"wx3ef4c5ac724a17a3",
        }
    }else if(packType == 2){
        return {
            preUrl: "http://oneshop.1bpcafe.cn/server/",                //咖啡馆生产域名
            appid: "wxe07a6187e67852b1",
        }
    }
}
//codeCenterPage页面二维码图标展示
const codeSrc = ()=>{
    if(packType == 0){
        return "http://ecshoptest.ebj.ebjcloud.com/ecshop/img/img/qrcode_for_gh_6ecc1343069b_258.jpg"
    }else if(packType == 1){
        return "http://ecshoptest.ebj.ebjcloud.com/ecshop/img/img/qrcode_for_gh_6ecc1343069b_258.jpg"
    }else if(packType == 2){
        return "http://oneshop.1bpcafe.cn/ecshop/img/img/qrcode_for_gh_c4fbd62e322a_430.jpg"
    }
}

const codeInfo = ()=>{
    if(packType == 0 || packType == 1){
        return {
            quanCN:'CN20180823000020',
            proNo1:'PN20180821000130',
            proNo2:'PN20180823000134',
            hexiao:'CN20180813000017',
            proNo3:'PN20180828000137',
            proNo4:'PN20180828000138',
            proNo5:'PN20180828000139',
        }
    }else if(packType == 2){
        return {
            quanCN:'CN20180824000009',              //分享券码
            proNo1:'PN20180822000050',              //商品券
            proNo2:'PN20180823000051',              //商品提货券
            hexiao:'CN20180824000010',              //核销券码
            proNo3:'PN20180828000052',              //两盒月饼
            proNo4:'PN20180828000053',              //5盒月饼
            proNo5:'PN20180828000054',              //10盒月饼
        }
    }
}
// if(packType == 0 || packType == 1){
//     const codeInfo = {
//         quanCN:'CN20180823000020',
//         proNo1:'PN20180821000130',
//         proNo2:'PN20180823000134',
//         hexiao:'CN20180813000017',
//     }
// }else if(packType == 2){
//     const codeInfo = {
//         quanCN:'CN20180824000009',              //分享券码
//         proNo1:'PN20180822000050',              //商品券
//         proNo2:'PN20180823000051',              //商品提货券
//         hexiao:'CN20180824000010',              //核销券码
//     }
// }
const packTypes = ()=>{
    return packTypes;
}

export {
    loginConfig,
    requestPort,
    picUrl,
    baseinfo,
    codeSrc,
    codeInfo,
    packTypes,
}